import 'package:base/base/theme.dart';
import 'package:base/base_lib.dart';
import 'package:base/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../res/lang.dart';
import 'login_logic.dart';

class LoginPage extends StatelessWidget {
  final logic = Get.find<LoginLogic>();

  LoginPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return TouchCloseSoftKeyboard(
        child: Scaffold(
            appBar: ToolBar(LoginStrRes.login),
            body: ListView(
              children: [
                Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
                  10.height,
                  Text(LoginStrRes.country_code,
                          style: KTheme.normalTextStyle14)
                      .paddingOnly(left: 12.w),
                  5.height,
                  TextField(
                    cursorColor: Colors.white,
                    decoration: const InputDecoration(
                      enabledBorder: OutlineInputBorder(
                          borderSide:
                              BorderSide(color: Color(0xffB6B6B6), width: 0.5)),
                      focusedBorder: OutlineInputBorder(
                          borderSide:
                              BorderSide(color: Color(0xffFD3F2A), width: 1)),
                      border: OutlineInputBorder(),
                      isCollapsed: true,
                      //重点，相当于高度包裹的意思，必须设置为true，不然有默认奇妙的最小高度
                      contentPadding:
                          EdgeInsets.symmetric(horizontal: 8, vertical: 10),
                      //内容内边距，影响高度
                      suffixIcon: Icon(Icons.arrow_downward),
                    ),
                    onTap: () {
                      "dddd".toast();
                    },
                  ).paddingOnly(left: 12.w, right: 12.w),
                  10.height,
                  Text(LoginStrRes.phone_number,
                          style: KTheme.normalTextStyle14)
                      .paddingOnly(left: 12.w),
                  10.height,
                  const TextField(
                    decoration: InputDecoration(
                      border: OutlineInputBorder(),
                      isCollapsed: true,
                      //重点，相当于高度包裹的意思，必须设置为true，不然有默认奇妙的最小高度
                      contentPadding:
                          EdgeInsets.symmetric(horizontal: 8, vertical: 10),
                    ),
                  ).paddingOnly(left: 12.w, right: 12.w),
                  Text(LoginStrRes.validate_phone_tip,
                          style: 10.toTextStyle(color: KColors.c_898989))
                      .paddingOnly(left: 12.w, top: 10.h, bottom: 10.h),
                  10.height,
                  Button(
                          color: KColors.primaryColor,
                          text: LoginStrRes.next,
                          disabledColor: KColors.c_E5E6E9,
                          enabled: false,
                          radius: 12.r,
                          textStyle: 16.toTextStyle(color: KColors.c_FFFFFF),
                          onTap: () {})
                      .paddingOnly(left: 12.w, right: 12.w),
                  10.height,
                  Stack(alignment: Alignment.center, children: [
                    10.line(color: KColors.c_1B61D6),
                    Center(
                        child: Text(LoginStrRes.or,
                            style: 12.toTextStyle(color: KColors.c_1B61D6)))
                  ]),
                  10.height,
                  Button(
                          color: KColors.c_FFFFFF,
                          text: LoginStrRes.login_with_email,
                          radius: 12.r,
                          borderColor: KColors.c_E5E6E9,
                          borderWidth: 1.w,
                          textStyle: 16.toTextStyle(color: KColors.c_333333),
                          onTap: () {})
                      .paddingOnly(left: 12.w, right: 12.w),
                  10.height,
                  Button(
                          color: KColors.c_FFFFFF,
                          text: LoginStrRes.continue_with_apple,
                          radius: 12.r,
                          borderColor: KColors.c_E5E6E9,
                          borderWidth: 1.0,
                          textStyle: 16.toTextStyle(color: KColors.c_333333),
                          onTap: () {})
                      .paddingOnly(left: 12.w, right: 12.w),
                  10.height,
                  Button(
                          color: KColors.c_FFFFFF,
                          text: LoginStrRes.login_with_google,
                          radius: 12.r,
                          borderColor: KColors.c_E5E6E9,
                          borderWidth: 1.0,
                          textStyle: 16.toTextStyle(color: KColors.c_333333),
                          onTap: () {})
                      .paddingOnly(left: 12.w, right: 12.w),
                  10.height,
                  Button(
                          text: LoginStrRes.login_with_facebook,
                          radius: 12.r,
                          borderColor: KColors.c_E5E6E9,
                          borderWidth: 1.0,
                          textStyle: 16.toTextStyle(color: KColors.c_333333),
                          onTap: () {})
                      .paddingOnly(left: 12.w, right: 12.w),
                  14.height,
                  Button(
                          color: Colors.transparent,
                          text: LoginStrRes.no_have_account,
                          textStyle: 16.toTextStyle(color: KColors.c_333333),
                          onTap: () {})
                      .paddingOnly(left: 12.w, right: 12.w),
                ])
              ],
            )));
  }
}
